package a10_动态规划;

/**
 * <p>
 * a19_零钱兑换2复习1
 * </p>
 *
 * @author flyduck
 * @since 2025/2/14
 */
public class a19_零钱兑换2复习1 {
    public int change(int amount, int[] coins) {
        int[] dp = new int[amount+1];
        dp[0] = 1;
        for (int i = 0; i < coins.length; i++) {
            for (int j = coins[i]; j <= amount; j++) {
                dp[j] = dp[j] + dp[j-coins[i]];
            }
        }
        return dp[amount];
    }
}
